<template>
  <div class="dy-main Purchasing">
    <div class="dy-header">
      <x-header :right-options="{showMore: false}" :left-options="{preventGoBack:true}" @on-click-back="back">购汇</x-header>
    </div>
    <div class="dy-body">
      <div class="imgBox"><img class="img" src="../../assets/img/Financial/nodataImg.png"></div>
      <div class="msgInfo" :class="{'msgInfoCenter': status === '1'}">{{ msg }}</div>
      <div @click="back" class="buttonGoback" :class="{'buttonGobackShort': status !== '4'}">{{ buttonText}}</div>
    </div>
  </div>
</template>

<script>
export default {
  data () {
    return {
      status: '5'
    }
  },
  computed: {
    msg () {
      if (this.status === '1') {
        return '非结售汇营业时间，请您在营业时间内交易。'
      } else if (this.status === '2') {
        return '您所持有的证件类型不支持办理手机银行个人购汇，请您前往我行营业网点办理'
      } else if (this.status === '3') {
        return '您已被列入“关注名单”，暂时无法通过网银办理结售汇业务，请前往我行营业网点办理。'
      } else if (this.status === '4') {
        return '您所持银行账号均不支持办理手机银行结售汇业务，请您添加理财通账号和外币账户或前往我行营业网点办理。'
      } else {
        return '您所持银行账号均不支持办理手机银行结售汇业务，暂无结售汇交易明细。'
      }
    },
    buttonText () {
      if (this.status === '4') {
        return '加挂卡号'
      } else {
        return '返回'
      }
    }
  },
  methods: {
    back () {
      this.$publicFun.goBack(this)
    },
    refreshTest () {
      let LVm = this
      this.$bridge.callhandler('nativeRequest',
        JSON.stringify({'requstSource': 'internetRequest', 'url': 'http://whichat.icitic.net/mstep/mstep.do?act=business', 'params': {'method_Name': 'M0401010', 'basic_Data': {'PayAccount': '6217298009765555', 'BuyAmt': '2001'}}}),
        function (response) {
          response = JSON.parse(response)
          if (response.status === 0 || response.status === '0') {
            LVm.prdList = response.data.data
          } else {
            LVm.aaa = response.data.data
          }
        }
      )
      // this.$router.push({name: 'FinancialBuySure', query: {'PayAccount': '6217298009765555', 'BuyAmt': '2001'}})
    }
  },
  created () {
    this.refreshTest()
  }
}
</script>

<style lang="less">
.Purchasing{
  .dy-body{
    .imgBox{
      margin: 0.9rem auto;
      height: 2.5rem;
      width: 3.3rem;
      .img{
        height: 2.5rem;
        width: 3.3rem;
      }
    }
    .msgInfo{
      font-size: 0.28rem;
      text-align: center;
      margin-bottom: 2.62rem;
      width: 92%;
      margin-left: 0.3rem;
      text-align: justify;
    }
    .msgInfoCenter{
      text-align: center;
    }
    .buttonGoback{
      height: 0.88rem;
      width: 6.9rem;
      margin: 0.64rem auto;
      line-height: 0.88rem;
      text-align: center;
      color: #fff;
      border-radius: 0.06rem;
      background: #EC1B30;
      font-size: 0.34rem;
    }
    .buttonGobackShort{
      width: 3rem;
      height: 0.88rem;
    }
  }
}
</style>
